<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //find方法查找数组  返回第一次查找到的  如果没有返回unfined
        // var persons = [{
        //     id: 1,
        //     pname: 'zhangsan'
        // }, {
        //     id: 2,
        //     pname: 'lisi'
        // }]
        // var person1 = persons.find(item => item.id == 1);
        // console.log(person1);
        // console.log(persons[0]);

        //findIndex方法  返回第一个所查数组元素索引号
        // var arr = [1, 2, 3, 4, 5];
        // let index = arr.findIndex(item => item > 2);
        // console.log(index);

        //includes方法判断数组中是否有某一个值 返回true  false
        let arr = ['a', 'b', 'c'];
        let result = arr.includes('a');
        let result2 = arr.includes('z');
        console.log(result);
        console.log(result2);
    </script>
</body>

</html>